package com.icangya.zhutong.sms;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

import com.icangya.zhutong.util.HttpRequest;
import com.icangya.zhutong.util.MD5Gen;
import com.icangya.zhutong.util.TimeUtil;

public class SmsDemo {

	public static void main1(String[] args) throws InterruptedException {
		/**
		 *    账号：sxdh888hy 密码：Ckhj7g
		 *	  账号：sxdh888yx 密码：zKEdCj
		 *    hy是发送验证码和通知信息的账号
		 *	  17093106236
		 */
		String url="http://www.api.zthysms.com/sendSms.do";
		String username="sxdh888hy";    //账号
		String password="Ckhj7g";       // 密码
		String tkey=TimeUtil.getNowTime("yyyyMMddHHmmss");
		String mobile="13268132797";  //发送的手机号
		String content="尊敬的用户：123456【盛世惠农,我就不，咋滴】";   //内容
		
		//String time="2016-09-06 17:48:22";//定时信息所需参数时间格式为yyyy-MM-dd HH:mm:ss
		String xh="";
		try {
			content=URLEncoder.encode(content, "utf-8");
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		}
		String param="url="+url+"&username="+username+"&password="+MD5Gen.getMD5(MD5Gen.getMD5(password)+tkey)+"&tkey="+tkey+"&mobile="+mobile+"&content="+content+"&xh="+xh;
		//String param="url="+url+"&username="+username+"&password="+MD5Gen.getMD5(MD5Gen.getMD5(password)+tkey)+"&tkey="+tkey+"&time="+time+"&mobile="+mobile+"&content="+content+"&xh="+xh;//定时信息url输出
		String ret=HttpRequest.sendPost(url,param);//定时信息只可为post方式提交
		System.out.println("ret:"+ret);
		System.out.println(param);

	}
}
